<template>
  <div id="custAdd">
    <!-- <Header :title="title" @backUp="backUp"></Header> -->
    <div class="month-aim-add">
      <div class="wap-row wap-row-line">
        <text class="impoets yxtlabel">拜访时间：</text>
        <div class="nob-wap" v-if="isEdit == 3">
          <span class="inputs empty narrow">{{ formData.visitTimeVal }}</span>
        </div>
        <div class="nob-wap" @click="shwoCustTime" v-else>
          <text
            class="inputs empty narrow"
            v-if="formData.visitTimeVal && formData.visitTimeVal.length > 0"
            >{{ formData.visitTimeVal }}</text
          >
          <text
            class="inputs empty placeHoder"
            v-else
            >请选择拜访时间</text
          >
          <div class="empty-left">
            <image
              src="configs/imgs/right-black.png"
              style="width:30px;height:30px"
            ></image>
          </div>
        </div>
      </div>

      <div class="wap-row wap-row-line">
        <text class="impoets yxtlabel">拜访对象：</text>
        <div class="nob-wap">
          <div class="inputs empty" v-if="isEdit == 3">
            <span
              style="overflow: hidden;white-space: nowrap;text-overflow: ellipsis;color: #666;font-weight: initial;text-align:right;line-height:70px; font-size:0.426rem;"
              >{{ formData.visitName }}</span
            >
          </div>
          <div class="empty-left empty-left-user" v-if="isEdit != 3">
            <input
              maxlength="30"
              class="inputs"
              type="text"
              style="margin-right: 10px;color: #666;font-size: 0.426rem;text-align:right"
              @blur="changeBlur"
              v-model="formData.visitName"
              placeholder="请输入客户姓名"
            />
            <image
              src="configs/imgs/user.png"
              class="pic"
              @click="choseUser"
            ></image>
            <image
              src="configs/imgs/call.png"
              class="pic"
              @click="choseAdressBook"
              style="margin-right:0;"
            ></image>
          </div>
        </div>
      </div>
      <div class="wap-row">
        <text class="impoets yxtlabel">客户类型：</text>
        <div class="nob-wap" v-if="isEdit == 3">
          <text class="inputs empty narrow">{{ formData.clientTypeValue }}</text>
        </div>
        <div class="nob-wap" @click="pickerOverLayClick" v-if="isEdit != 3">
          <text
            class="inputs empty narrow"
            v-if="formData.clientTypeValue && formData.clientTypeValue.length > 0"
            >{{ formData.clientTypeValue }}</text
          >
          <text
            class="inputs empty placeHoder"
          
            v-else
            >请选择客户类型</text
          >
          <div class="empty-left" style="height: 70px;line-height: 70px;">
            <image
              src="configs/imgs/right-black.png"
              style="width:30px;height:30px"
            ></image>
          </div>
        </div>
      </div>
      <div class="class-div-interval"></div>
      <div class="wap-row">
        <text class="no-import yxtlabel">拜访情况：</text>
      </div>
      <div class="wap-row">
        <textarea
          class="textareInput"
          rows="8"
          placeholder="请输入拜访情况"
          :disabled="isEdit === 3"
          v-model="formData.visitCondition"
          @blur="changeBlur"
          ref='textArea1'
          maxlength="600"
        />
      </div>
      <div class="wap-row count-num">
          {{ formData.visitCondition | formatRemak }}/600
      </div>
      <div class="class-div-interval"></div>
      <div class="wap-row">
        <text class=" impoets yxtlabel">拜访方式：</text>
      </div>
      <div class="wap-row">
        <div class="wap-row-plain">
          <div class="state-wap">
            <div class="state-tag">
              <div v-for="(item, index) in custType" :key="index" class="state-item state-wap-item"
                  @click="chosecustType(item, index)"
                  :class="
                    formData.visitPath === item.keys
                      ? 'is-notic-item-active'
                      : ''
                  ">
                  {{ item.value }}
              </div>
            </div>
          </div>
        </div>
      </div>
      <div class="wap-row cust-aim">
        <text class=" impoets yxtlabel">拜访目的：</text>
        <text class="more">可多选</text>
      </div>
      <div class="wap-row">
        <!-- yuefang -->
        <div class="wap-row-plain">
          <div class="state-wap">
            <div class="state-tag">
              <div v-for="(item, index) in custAim" :key="index" class="state-item state-wap-item"
                  @click="chosecustAim(item, index)"
                  :class="
                    choseCustAimList.includes(item.keys)
                      ? 'is-notic-item-active'
                      : ''
                  "
                >
                  {{ item.value }}
              </div>
            </div>
          </div>
        </div>
      </div>

      <div class="wap-row" v-if="choseCustAimList.length > 0">
        <div class="result">
          <text class=" impoets cust-res yxtlabel" style="margin-bottom:10px">拜访结果：</text>
          <div class="">
            <!-- 约访 -->
            <div
              class="wap-row-plain tag-left"
              v-if="choseCustAimList.includes('01')"
            >
              <div>
                <text class=" ">约访</text>
              </div>
              <div class="state-wap">
                <div class="state-tag" :class="shwoYFVal.length < 5 ? 'nowrap' : 'wrap'">
                  <div v-for="(item, index) in yuefangList" :key="index" class="state-item">
                    <div
                      v-if="item.value"
                      class="state-wap-item"
                      @click="choseyuefang(item, index)"
                      :class="{
                        'is-notic-item-active': formData.yf === item.keys
                      }"
                    >
                      {{ item.value }}
                    </div>
                    <div
                      v-if="!item.value && isEdit != 3"
                      class="state-wap-item"
                      @click="
                        shwoYF = !shwoYF;
                        formData.yf = '03';
                      "
                      :class="{
                        'is-notic-item-active': formData.yf == '03',
                        addActive: shwoYFVal.length === 0
                      }"
                    >
                      {{ shwoYFVal }}
                    </div>
                  </div>
                  <div
                    class="state-item state-wap-item is-notic-item-active-add"
                    v-if="isEdit == 3 && shwoYFVal.length != 0"
                    :class="{
                      'is-notic-item-active': formData.yf == '03',
                      addActive: shwoYFVal.length === 0
                    }"
                  >
                    {{ shwoYFVal }}
                  </div>
                </div>
                <div v-if="shwoYF" class="bor">
                  <input
                    :disabled="isEdit === 3"
                    class="bor-input "
                    v-model="shwoYFVal"
                    placeholder="拜访结果(手输)"
                    maxlength="10"
                    @blur="changeBlur"
                  />
                  <p class="count-length">{{ shwoYFVal.length || 0 }}/10</p>
                </div>
              </div>
            </div>
            <div
              class="wap-row-plain tag-left"
              v-if="choseCustAimList.includes('02')"
            >
              <div>
                <text class=" ">加温</text>
              </div>
              <div class="state-wap">
                <div class="state-tag ">
                  <div v-for="(item, index) in jiaWenList" :key="index" class="state-item">
                    <div
                      v-if="index < 4"
                      class="state-wap-item wap-item"
                      @click="choseJiawen(item, index)"
                      :class="
                        formData.jw === item.keys ? 'is-notic-item-active' : ''
                      "
                    >
                      {{ item.value }}
                    </div>
                  </div>
                </div>
                <div class="state-tag " :class="shwoJwVal.length < 5 ? 'nowrap' : 'wrap'">
                  <div v-for="(item, index) in jiaWenList" :key="index" class="state-item">
                    <div v-if="index >= 4">
                      <div
                        class="state-wap-item"
                        v-if="item.value"
                        @click="choseJiawen(item, index)"
                        :class="
                          formData.jw === item.keys
                            ? 'is-notic-item-active'
                            : ''
                        "
                      >
                        {{ item.value }}
                      </div>
                      <div
                        v-if="!item.value && isEdit != 3"
                        class="state-wap-item"
                        @click="
                          formData.jw = '06';
                          shwoJw = !shwoJw;
                        "
                        :class="{
                          'is-notic-item-active': formData.jw == '06',
                          addActive: shwoJwVal.length === 0
                        }"
                      >
                        {{ shwoJwVal }}
                      </div>
                    </div>
                  </div>
                  <div
                    class="state-item state-wap-item is-notic-item-active-add"
                    v-if="isEdit == 3 && shwoJwVal.length != 0"
                    :class="{
                      'is-notic-item-active': formData.jw == '06',
                      addActive: shwoJwVal.length === 0
                    }"
                  >
                    {{ shwoJwVal }}
                  </div>
                </div>
                <div v-if="shwoJw" class="bor">
                  <input
                    :disabled="isEdit === 3"
                    class="bor-input "
                    v-model="shwoJwVal"
                    placeholder="拜访结果(手输)"
                    maxlength="10"
                    @blur="changeBlur"
                  />
                  <p class="count-length">{{ shwoJwVal.length || 0 }}/10</p>
                </div>
              </div>
            </div>
            <div
              class="wap-row-plain tag-left"
              v-if="choseCustAimList.includes('03')"
            >
              <!-- xiaoshou -->
              <div>
                <text class=" ">销售</text>
              </div>
              <div class="state-wap">
                <div class="state-tag ">
                  <div v-for="(item, index) in xiaoshouList" :key="index" class="state-item">
                    <div
                      v-if="index < 4"
                      class="state-wap-item wap-item"
                      @click="choseXiaoshou(item, index)"
                      :class="
                        formData.xs === item.keys ? 'is-notic-item-active' : ''
                      "
                    >
                      {{ item.value }}
                    </div>
                  </div>
                </div>
                <div class="state-tag " :class="shwoXsVal.length < 5 ? 'nowrap' : 'wrap'">
                  <div v-for="(item, index) in xiaoshouList" :key="index" class="state-item">
                    <div v-if="index >= 4">
                      <div
                        class="state-wap-item wap-item"
                        @click="choseXiaoshou(item, index)"
                        :class="
                          formData.xs === item.keys
                            ? 'is-notic-item-active'
                            : ''
                        "
                        v-if="item.value"
                      >
                        {{ item.value }}
                      </div>
                      <div
                        v-if="!item.value && isEdit != 3"
                        class="state-wap-item wap-item"
                        @click="
                          formData.xs = '07';
                          shwoXs = !shwoXs;
                        "
                        :class="{
                          'is-notic-item-active': formData.xs == '07',
                          addActive: shwoXsVal.length === 0
                        }"
                      >
                        {{ shwoXsVal }}
                      </div>
                    </div>
                  </div>
                  <div
                    class="state-item state-wap-item is-notic-item-active-add"
                    v-if="isEdit == 3 && shwoXsVal.length != 0"
                    :class="{
                      'is-notic-item-active': formData.xs == '07',
                      addActive: shwoXsVal.length === 0
                    }"
                  >
                    {{ shwoXsVal }}
                  </div>
                </div>
                <div v-if="shwoXs" class="bor">
                  <input
                    :disabled="isEdit === 3"
                    class="bor-input "
                    v-model="shwoXsVal"
                    placeholder="拜访结果(手输)"
                    maxlength="10"
                    @blur="changeBlur"
                  />
                  <p class="count-length">{{ shwoXsVal.length || 0 }}/10</p>
                </div>
              </div>
            </div>
            <!-- 服务 -->
            <div
              class="wap-row-plain tag-left"
              v-if="choseCustAimList.includes('04')"
            >
              <!-- xiaoshou -->
              <div>
                <text class=" ">服务</text>
              </div>
              <div class="state-wap">
                <div class="state-tag ">
                  <div v-for="(item, index) in fuwuList" :key="index" class="state-item">
                    <div
                      v-if="index < 4"
                      class="state-wap-item wap-item"
                      @click="chosefuwu(item, index)"
                      :class="
                        formData.fw === item.keys ? 'is-notic-item-active' : ''
                      "
                    >
                      {{ item.value }}
                    </div>
                  </div>
                </div>
                <div class="state-tag " :class="shwoFwVal.length < 5 ? 'nowrap' : 'wrap'">
                  <div v-for="(item, index) in fuwuList" :key="index" class="state-item">
                    <div v-if="index >= 4">
                      <div
                        class="state-wap-item wap-item"
                        v-if="item.value"
                        @click="chosefuwu(item, index)"
                        :class="
                          formData.fw === item.keys
                            ? 'is-notic-item-active'
                            : ''
                        "
                      >
                        {{ item.value }}
                      </div>
                      <div
                        class="state-wap-item wap-item"
                        v-if="!item.value && isEdit != 3"
                        @click="
                          formData.fw = '06';
                          shwoFw = !shwoFw;
                        "
                        :class="{
                          'is-notic-item-active': formData.fw == '06',
                          addActive: shwoFwVal.length === 0
                        }"
                      >
                        {{ shwoFwVal }}
                      </div>
                    </div>
                  </div>
                  <div
                    class="state-item state-wap-item is-notic-item-active-add"
                    v-if="isEdit == 3 && shwoFwVal.length != 0"
                    :class="{
                      'is-notic-item-active': formData.fw == '06',
                      addActive: shwoFwVal.length === 0
                    }"
                  >
                    {{ shwoFwVal }}
                  </div>
                </div>
                <div v-if="shwoFw" class="bor">
                  <input
                    :disabled="isEdit === 3"
                    class="bor-input "
                    v-model="shwoFwVal"
                    placeholder="拜访结果(手输)"
                    maxlength="10"
                    @blur="changeBlur"
                  />
                  <p class="count-length">{{ shwoFwVal.length || 0 }}/10</p>
                </div>
              </div>
            </div>
            <!-- 转介绍 -->
            <div
              class="wap-row-plain tag-left"
              v-if="choseCustAimList.includes('05')"
            >
              <!-- xiaoshou -->
              <div>
                <text class=" ">转介绍</text>
              </div>
              <div class="state-wap">
                <div class="state-tag " :class="shwoZjsVal.length < 5 ? 'nowrap' : 'wrap'">
                  <div v-for="(item, index) in jieshaoList" :key="index" class="state-item">
                    <div
                      v-if="item.value"
                      class="state-wap-item wap-item"
                      @click="chosezjs(item, index)"
                      :class="{
                        itemMargin: index == 3,
                        'is-notic-item-active': formData.zjs === item.keys
                      }"
                    >
                      {{ item.value }}
                    </div>
                    <div
                      class="state-wap-item wap-item"
                      v-if="!item.value && isEdit != 3"
                      @click="
                        formData.zjs = '04';
                        shwoZjs = !shwoZjs;
                      "
                      :class="{
                        itemMargin: shwoZjsVal.length >= 5,
                        'is-notic-item-active': formData.zjs == '04',
                        addActive: shwoZjsVal.length === 0
                      }"
                    >
                      {{ shwoZjsVal }}
                    </div>
                  </div>
                  <div
                    class="state-item state-wap-item is-notic-item-active-add"
                    v-if="isEdit == 3 && shwoZjsVal.length != 0"
                    :class="{
                      itemMargin: shwoZjsVal.length >= 5,
                      'is-notic-item-active': formData.zjs == '04',
                      addActive: shwoZjsVal.length === 0,
                    }"
                  >
                    {{ shwoZjsVal }}
                  </div>
                </div>
                <div v-if="shwoZjs" class="bor">
                  <input
                    :disabled="isEdit === 3"
                    class="bor-input "
                    v-model="shwoZjsVal"
                    placeholder="拜访结果(手输)"
                    maxlength="10"
                    @blur="changeBlur"
                  />
                  <p class="count-length">{{ shwoZjsVal.length || 0 }}/10</p>
                </div>
              </div>
            </div>
            <!-- -->
            <div
              class="wap-row-plain tag-left"
              v-if="choseCustAimList.includes('06')"
            >
              <!-- xiaoshou -->
              <div>
                <text class=" ">增员</text>
              </div>
              <div class="state-wap">
                <div class="state-tag ">
                  <div v-for="(item, index) in addUser" :key="index" class="state-item">
                    <div
                      v-if="index < 4"
                      class="state-wap-item wap-item"
                      @click="chosezy(item, index)"
                      :class="
                        formData.zy === item.keys ? 'is-notic-item-active' : ''
                      "
                    >
                      {{ item.value }}
                    </div>
                  </div>
                </div>
                <div class="state-tag " :class="shwoZYVal.length < 5 ? 'nowrap' : 'wrap'">
                  <div v-for="(item, index) in addUser" :key="index" class="state-item">
                    <div v-if="index >= 4">
                      <div
                        class="state-wap-item wap-item"
                        v-if="item.value"
                        @click="chosezy(item, index)"
                        :class="
                          formData.zy === item.keys
                            ? 'is-notic-item-active'
                            : ''
                        "
                      >
                        {{ item.value }}
                      </div>
                      <div
                        class="state-wap-item wap-item"
                        v-if="!item.value && isEdit != 3"
                        @click="
                          formData.zy = '06';
                          shwoZY = !shwoZY;
                        "
                        :class="{
                          'is-notic-item-active': formData.zy == '06',
                          addActive: shwoZYVal.length === 0
                        }"
                      >
                        {{ shwoZYVal }}
                      </div>
                    </div>
                  </div>
                  <div
                    class="state-item state-wap-item is-notic-item-active-add"
                    v-if="isEdit == 3 && shwoZYVal.length != 0"
                    :class="{
                      'is-notic-item-active': formData.zy == '06',
                      addActive: shwoZYVal.length === 0
                    }"
                  >
                    {{ shwoZYVal }}
                  </div>
                </div>
                <div v-if="shwoZY" class="bor">
                  <input
                    :disabled="isEdit === 3"
                    class="bor-input "
                    v-model="shwoZYVal"
                    placeholder="拜访结果(手输)"
                    maxlength="10"
                    @blur="changeBlur"
                  />
                  <p class="count-length">{{ shwoZYVal.length || 0 }}/10</p>
                </div>
              </div>
            </div>

            <!-- 加温 -->
          </div>
        </div>
        <div></div>
      </div>

        <div class="class-div-interval"></div>
        <div class="wap-row">
          <text class="impoets yxtlabel">拜访地点：</text>
          <div class="nob-wap" v-if="isEdit == 3">
            <text class="inputs empty narrow">{{ formData.visitAddress }}</text>
          </div>
          <div class="nob-wap" @click="choseArea" v-if="isEdit != 3">
            <text
              class="inputs empty narrow"
              v-if="formData.visitAddress && formData.visitAddress.length"
              >{{ formData.visitAddress }}</text
            >
            <text
              class="inputs empty"
              style="color: #696767;font-size: 0.426rem;"
              v-else
              >请选择拜访地点</text
            >
            <div class="empty-left">
              <image
                src="configs/imgs/local.png"
                style="width:30px;height:30px"
              ></image>
            </div>
          </div>
        </div>

        <div class="wap-row">
          <text class='yxtlabel'>详细地址：</text>
        </div>
        <div class="wap-row">
          <textarea
            class="textareInput no-import"
            rows="5"
            placeholder="请输入详细地址"
            :disabled="isEdit === 3"
            v-model="formData.visitAddressDetail"
            @blur="changeBlur"
            ref='textArea2'
            maxlength="100"
          />
        </div>
        <div class="wap-row count-num">
          {{ formData.visitAddressDetail | formatRemak }}/100
        </div>
        
        <div class="class-div-interval"></div>
        <div class="wap-row mar-bottom">
          <text class="yxtlabel">添加图片：</text>
        </div>
        <image :src="testImg"></image>
        <div class="wap-row pisc">
          <div
            class="pics pics-t"
            v-for="(item, index) in picList"
            :key="index"
          >
            <image :src="item.value" class="imagesS"></image>
            <div class="close-t" @click="removePic(index)" v-if="isEdit != 3">
              x
            </div>
          </div>
           
            <div
              class="pics adds"
              v-if="picList.length < 5 && isEdit != 3"
              @click="chosePictureFlag = true"
            >
              <span class='add'>+</span>
              <span style="font-size:12px;color:#5D788A;">上传图片</span>
            </div>
        </div>
        <div v-if="isEdit !== 1" class="wap-row">
          <div class="backMessage">
            <text class="replay-import yxtlabel">批阅回复：</text>
            <div class="no-import state-wap replay-red">
              {{ formData.judgeReply || "未回复" }}
            </div>
          </div>
        </div>

      <div
        v-if="judgeStatus !== '' && judgeStatus != 'XQ'"
        class="approvalOptions"
      >
        <div>
          <div class="optionTitle">审批意见：</div>
          <div class="lineBottom"></div>
        </div>
        <textarea
          class="textareInput"
          rows="4"
          placeholder="请输入审批意见"
          v-model="approvalOption"
          @blur="changeBlur"
        ></textarea>
        <div class="conditionLength">
          {{ approvalOption | formatRemak }}/100
        </div>
        <div class="optionBtn">
          <div @click="modify">
            <image src="configs/imgs/backOption.png"></image>
            退回修改
          </div>
          <div @click="approvalThrough">
            <image src="configs/imgs/sureOption.png"></image>
            审批通过
          </div>
        </div>
      </div>
      <div v-else>
        <div class="btns big-btns" v-if="isEdit == 1">
          <wxc-Button
            text="提 交"
             type="blue"
            :class="!flagBtn ? 'active-btn' : ''"
            @click.native="addUpDayAndMonth"
            :disable="!flagBtn"
          ></wxc-Button>
        </div>
        <div class="btns" v-if="isEdit == 2">
          <div class="btns-w">
            <wxc-Button
              text="删 除"
              :textStyle="textStyle"
              class="save-btn btn-del"
              size="medium"
              @click.native="deleteDayAndMonth"
            ></wxc-Button>
          </div>
          <div class="btns-w">
            <wxc-Button
              text="提 交"
              type="blue"
              class="save-btn"
              size="medium"
              @click.native="addUpDayAndMonth"
            ></wxc-Button>
          </div>
        </div>
        <div class="btns big-btns" v-if="isEdit == 3">
          <div class="btns-w">
            <wxc-Button
              text="返回"
              type="blue"
              @click.native="backUpDayAndMonth"
            ></wxc-Button>
          </div>
        </div>
      </div>
    </div>

    <!-- <x-picker
      type="area"
      :show="showArea"
      @overlayClick="pickerOverLayClick"
      @onchange="areaChange"
    ></x-picker> -->

    <wxc-popup
      popup-color="#fff"
      :show="chosePictureFlag"
      pos="bottom"
      height="300"
      @wxcPopupOverlayClicked="chosePictureFlag = false"
    >
      <div class="chosePic-wap">
        <div class="chosePic-wap-item" @click="GetPic(1)">拍照</div>
        <div class="chosePic-wap-item" @click="GetPic(2)">从手机相册选取</div>
        <lineArea></lineArea>
        <div
          class="chosePic-wap-item close-chosePic "
          @click="chosePictureFlag = false"
        >
          取消
        </div>
      </div>
    </wxc-popup>
    <loading class="loading" v-if="loading">
      <text class="indicator-text"></text>
      <loading-indicator class="indicator"></loading-indicator>
    </loading>
    <Confirm :confirmOptions="confirmOptions" ref='myConfirm'></Confirm>
  </div>
</template>

<script>
import { WxcButton, WxcPopup } from "weex-ui";
import { Uploader } from 'vant';
import Header from "../customerComponents/Header";
import lineArea from "../customerComponents/lineAre";
import Confirm from "../confirm/Confirm";
import sysHttp from "@/service/sys.seting.job.js"
var modal = weex.requireModule("modal");
import { parseTime,getBase64Image } from "@/utils";
import { XPicker } from "weex-x-picker";
import moment from 'moment';
export default {
  props: {},
  filters: {
    VTimeFormat(value) {
      if (value) {
        return value;
      } else return "请选择拜访时间";
    },
    formatRemak(val) {
      return val ? val.length : 0;
    }
  },
  watch: {
    "formData.visitCondition"(newval, oldval) {
      if (newval && newval.length > 600) {
        this.formData.visitCondition = oldVal;
      }
    }
  },

  data() {
    return {
      loading:false,
      confirmOptions: {},
      textStyle:{color:'#ffffff'},
      chosePictureFlag: false,
      flagBtn: false,
      shwoYFVal: "",
      shwoYF: false,
      shwoJw: false,
      shwoJwVal: "",
      shwoXs: false,
      shwoXsVal: "",
      shwoFwVal: "",
      shwoFw: false,
      shwoZjsVal: "",
      shwoZjs: false,
      shwoZYVal: "",
      shwoZY: false,
      showPicker: false,
      showArea: false,
      type: "",
      baofei: "",
      title: "",
      photoIndex:0,
      testImg:'',
      isEdit: 1, //1add 2 edit 3 info
      //拜访方式
      custType: [
        { keys: "01", value: "面访" },
        { keys: "02", value: "电话" },
        { keys: "03", value: "微信" },
        { keys: "04", value: "短信" }
      ],
      //客户类型
      clientType: [ 
        { key: "准客户", value: "01" },
        { key: "老客户", value: "02" },
        { key: "企业客户", value: "03" },
        { key: "增员", value: "04" }
      ],
      //约访
      yuefangList: [
        { keys: "01", value: "成功" },
        { keys: "02", value: "不成功" },
        { keys: "03", value: "" }
      ],
      // 加温
      jiaWenList: [
        { keys: "01", value: "成功破冰" },
        { keys: "02", value: "关系提升" },
        { keys: "03", value: "切入保险" },
        { keys: "04", value: "没有进展" },
        { keys: "05", value: "被拒绝" },
        { keys: "06", value: "" }
      ],
      //销售
      xiaoshouList: [
        { keys: "01", value: "初步讲解" },
        { keys: "02", value: "方案待定" },
        { keys: "03", value: "待促成" },
        { keys: "04", value: "已成单" },
        { keys: "05", value: "没有进展" },
        { keys: "06", value: "倾向拒绝" },
        { keys: "07", value: "" }
      ],
      //服务
      fuwuList: [
        { keys: "01", value: " 递送保单" },
        { keys: "02", value: "保单检视" },
        { keys: "03", value: "保全变更" },
        { keys: "04", value: "理赔" },
        { keys: "05", value: "续期缴费" },
        { keys: "06", value: "" }
      ],
      // 介绍、
      jieshaoList: [
        { keys: "01", value: " 获得引荐" },
        { keys: "02", value: "获取名单" },
        { keys: "03", value: "未获得" },
        { keys: "04", value: "" }
      ],
      //增员
      addUser: [
        { keys: "01", value: " 不抵触" },
        { keys: "02", value: "有意向" },
        { keys: "03", value: "新人班" },
        { keys: "04", value: "可入司" },
        { keys: "05", value: "倾向拒绝" },
        { keys: "06", value: "" }
      ],
      custAim: [
        {
          keys: "01",
          value: "约访"
        },
        {
          keys: "02",
          value: "加温"
        },
        {
          keys: "03",
          value: "销售"
        },
        {
          keys: "04",
          value: "服务"
        },
        {
          keys: "05",
          value: "转介绍"
        },
        {
          keys: "06",
          value: "增员"
        }
      ],
      choseCustAimList: [],
      formData: {
        yf: "", //约访
        jw: "", //加温，
        xs: "",
        fw: "",
        zjs: "",
        zy: "",
        empId: '',
        clientType: "", //客户类型:01.准客户、02.老客户、03.企业客户、04.增员
        visitPath: "", //	string 拜访方式:01.面访、02.电话、03.微信、04.短信
        visitAim: [], //string拜访目的:01.约访、02.加温、03.销售、04.服务、05.转介绍、06.增员
        visitAddress: "",
        visitCondition: "",
        clientTypeValue: "",
        visitName: "",
        visitTime: "",
        visitTimeVal: "",
        visitAddressDetail: "" //info  adress
      },
      visitAimflag: "",
      userInfo: {},
      queryData: {},
      visitAimflag: "",
      approvalOption: "",
      judgeStatus: "",
      picList: [],
      Typecust: "",
      time: sessionStorage.getItem("Time")
    };
  },
  components: { Header, WxcButton, lineArea, XPicker, WxcPopup, Confirm },
  created() {
    let _this = this
    // document.addEventListener('backbutton',_this.backUp,false)
    this.userInfo = JSON.parse(sessionStorage.getItem("userInfo"));
    this.empId = this.userInfo.empId;
    let u = navigator.userAgent;
    if (u.indexOf('Android') > -1 || u.indexOf('Linux') > -1) { // 安卓手机
      document.addEventListener('backbutton',_this.backUp,false)
    }else{
      this.$dd.biz.navigation.setLeft({
        show: true, //控制按钮显示
        control: true,//是否控制点击事件
        text: '',//控制显示文本
        onSuccess : function(result) {
        //返回上一页所在的内容
         _this.backUp();
        },
        onFail:function(){}
      });
    }
    if (this.$route.query) {
      this.judgeStatus = this.$route.query.judgeStatus
        ? this.$route.query.judgeStatus
        : "";
      if (this.$route.query.isEdit == 1) {
        this.title = "新增拜访记录";
      } else if (this.$route.query.isEdit == 2) {
        this.getInfoById(this.$route.query.quetyId);
        this.title = "拜访记录编辑";
      } else if (
        this.$route.query.isEdit == 3 &&
        this.judgeStatus == "" &&
        this.judgeStatus != "XQ"
      ) {
        this.getInfoById(this.$route.query.quetyId);
        this.title = "查看拜访记录";
      } else if (this.judgeStatus !== "" && this.judgeStatus != "XQ") {
        this.title = "审批";
        this.getInfoById(this.$route.query.quetyId);
      } else {
        this.title = "查看拜访记录";
        this.getInfoById(this.$route.query.quetyId);
        
      }
      this.$dd.biz.navigation.setTitle({
        title : this.title,//控制标题文本，空字符串表示显示默认文本
        onSuccess : function(result) {
        },
        onFail : function(err) {}
      });
      if (this.$route.query.hasOwnProperty("cusName")) {
        this.queryData = this.$route.query;
        let query = sessionStorage.getItem("localUser");
        this.formData = JSON.parse(query);
        this.title = this.formData.title;
        this.formData.visitName = this.queryData.cusName;
      }
      
      this.isEdit =
        this.$route.query && this.$route.query.isEdit
          ? this.$route.query.isEdit
          : 1;
    }
    // this.time = sessionStorage.getItem("Time");
    // const warpper = document.getElementById("wrapper");
    // warpper.scrollTo(0,0);
  },
  beforeDestroy(){
    let _this = this
    let u = navigator.userAgent;
    if (u.indexOf('Android') > -1 || u.indexOf('Linux') > -1) { // 安卓手机
      document.removeEventListener('backbutton',_this.backUp,false)
    } 
  },
  methods: {
    changeBlur() {
      setTimeout(() => {
        const scrollHeight =
          document.documentElement.scrollTop || document.body.scrollTop || 0;
        window.scrollTo(0, Math.max(scrollHeight - 1, 0));
      }, 200);
    },
    //选择拜访用户
    shwoCustTime(val) {
      if (this.isEdit == 3) {
        return;
      } else {
          let _this = this
          this.$dd.biz.util.timepicker({
            format: 'HH:mm',//注意：format只支持android系统规范，即2015-03-31格式为yyyy-MM-dd
            value: parseTime(new Date(),'{h}:{i}'), //默认显示日期
            onSuccess : function(result) {
              let response = result.value+'';
              let temps = response.split(":");
              let str = "上午 ";
              if (temps[0] > 12) {
                str = "下午";
              }
              _this.formData.visitTimeVal = str + temps[0] + ":" + temps[1];
              let newDate = _this.time + " " + temps[0] + ":" + temps[1];
              _this.formData.visitTime = newDate;
              _this.$forceUpdate();
              _this.changeBlur();
            },
            onFail : function(err) {
              console.log(err)
            }
          })
      }
    },
    ChoseCustTYpe() {
      if (this.isEdit == 3) {
        return;
      }
      let params = [
        { key: "01", value: "准客户" },
        { key: "02", value: "老客户" },
        { key: "03", value: "企业客户" },
        { key: "04", value: "增员" }
      ];

    },
    removePic(index) {
      this.picList.splice(index, 1);
    },

    GetPic(type) {
      this.chosePictureFlag = false;
      let _this = this;
      if(type == 1){
        this.$dd.biz.util.uploadImageFromCamera({
          "compression":true, //(是否压缩，默认为true)
          onSuccess: function(result) {
              _this.picList.push({
                keys: _this.photoIndex,
                value: result[0]
              });
              _this.photoIndex++;
						},
          onFail: function(err) {}
        })
      }else if(type == 2){
        this.$dd.biz.util.uploadImage({
          "stickers":{"time":"08:35"},
          onSuccess: function(result) {
              let image = new Image();
              image.src= result
              let imageBase64 = getBase64Image(image);
              _this.picList.push({
                keys:  _this.photoIndex,
                value: result[0]
              });
              _this.photoIndex++;
					},
          onFail: function(err) {}
        })
      }
      // this.$bridge.callHandler("getPicture", type, response => {
      //   let param = {
      //     empId: userInfo.empId,
      //     base64: "data:image/jpeg;base64," + response
      //   };
      //   // sysHttp.uploadImage(param).then(
      //   //   res => {

      //   //   }
      //   // )
      //   $api.ajax(
      //     {
      //       url: "uploadImage",
      //       method: "POST", //默认 GET，默认可以省略
      //       data: param //可以不填写，默认为 ""
      //     },
      //     res => {
      //       if (res.status === 200) {
      //         if (res.data) {
      //           this.picList.push({
      //             keys: res.data.result,
      //             value: "data:image/jpeg;base64," + response
      //           });
      //         }
      //       } else {
      //         this.$refs.myConfirm.showModal();
      //         this.confirmOptions = {
      //           confirmType: 'error',
      //           confirmContent: res.data.message,
      //           btnFlag: false,
      //           success: function() {
      //           },
      //           error: function() {
      //           }
      //         }
      //       }
      //       console.log("请求结果：" + res.data);
      //     }
      //   );
      // });
    },
    backUp(e) {
      this.$refs.textArea1.blur();
      this.$refs.textArea2.blur();
      let u = navigator.userAgent;
      if (u.indexOf('Android') > -1 || u.indexOf('Linux') > -1) { // 安卓手机
        e.preventDefault();
      }
      if (this.judgeStatus == "") {
        sessionStorage.setItem("keyId", 2);
      } else {
        sessionStorage.setItem("keyId", 5);
      }
      let calendar = sessionStorage.getItem('calendar') ? sessionStorage.getItem('calendar') : null;
      if(calendar != null){
        this.$router.push({
          path:'/pickerDate'
        })
        return;
      }
      if (this.isEdit == 3) {
        this.$router.replace({
          path:'/work'
        })
        return;
      }
      let flag = false;
      if (this.formData.visitTimeVal !== "") {
        flag = true;
      }
      if (this.formData.visitName !== "") {
        flag = true;
      }
      if (this.formData.clientTypeValue !== "") {
        flag = true;
      }
      if (this.formData.visitCondition !== "") {
        flag = true;
      }
      if (this.formData.visitPath !== "") {
        flag = true;
      }
      if (this.choseCustAimList.length !== 0) {
        flag = true;
      }
      if (this.formData.visitCondition !== "") {
        flag = true;
      }
      if (this.formData.jw !== "") {
        flag = true;
      }
      if (this.formData.xs !== "") {
        flag = true;
      }
      if (this.formData.fw !== "") {
        flag = true;
      }
      if (this.formData.zy !== "") {
        flag = true;
      }
      if (this.formData.zjs !== "") {
        flag = true;
      }
      let _this = this;
      if (flag) {
        this.$refs.myConfirm.showModal();
        this.confirmOptions = {
          confirmContent: "您录入的信息未保存，确认退出？",
          btnFlag: true,
          success: function() {
           _this.$router.replace({
            path:'/work'
          })
          },
          error: function() {
          }
        }
      } else {
        _this.$router.replace({
          path:'/work'
        })
      }
    },
    choseArea() {
      let _this = this
      if (this.isEdit == 3) {
        return;
      }
       this.$dd.biz.map.locate({
						latitude: '31.23', // 纬度，非必须
						longitude: '121.47', // 经度，非必须
						onSuccess: function(result) {
							// alert(JSON.stringify(result))
							_this.formData.visitAddress = `${result.city} ${result.adName}` 
						},
						onFail: function(err) {}
					});
    },
    // 原生通讯录
    choseAdressBook() {
      let _this = this
      this.$dd.biz.contact.chooseMobileContacts({
        multiple: false,//是否多选
        maxUsers: 1500,//最大人数
        limitTips:'最多选取1500人',//最大值提示
        title:'通讯录',//
        onSuccess: function(data){
          // alert(JSON.stringify(data))
          let temp = data[0];
          _this.formData.visitName = temp.name;
          _this.changeBlur();
        },
        onFail: function(err){}
      })
    },

    choseUser() {
      modal.toast({
        message: "功能正在开发中..",
        duration: 0.3
      })
      // if (this.isEdit == 3) {
      //   return;
      // }
      // this.formData.title = this.title;
      // sessionStorage.setItem("localUser", JSON.stringify(this.formData));
      // this.$router.replace({
      //   path: "/customerSearch?custType=1",
      //   query: {
      //     jump: "jumpCallBack",
      //     isEdit: this.isEdit
      //   }
      // });
    },
    pickerOverLayClick() {
      let _this = this
       this.$dd.biz.util.chosen({
          source: [ 
            { key: "准客户", value: "01" },
            { key: "老客户", value: "02" },
            { key: "企业客户", value: "03" },
            { key: "增员", value: "04" }
          ],
          selectedKey: '选项2', // 默认选中的key
          onSuccess: function(result) {
            _this.formData.clientTypeValue = result.key;
            _this.formData.clientType = result.value;
            _this.$forceUpdate();
          },
          onFail: function(err) {}
       })
    },
     
    areaChange(e) {
      this.formData.visitAddress = e.values.join("");
      this.changeBlur();
    },
    backUpDayAndMonth() {
      if (this.judgeStatus == "") {
        sessionStorage.setItem("keyId", 2);
      } else {
        sessionStorage.setItem("keyId", 5);
      }
      this.$router.replace({
        path: "/work"
      });
    },

    //选择约访
    choseyuefang(item, index) {
      if (this.isEdit == 3) {
        return;
      }
      this.shwoYF = false;
      this.formData.yf = item.keys;
      this.$forceUpdate();
    },
    //选择加温
    choseJiawen(item, index) {
      if (this.isEdit == 3) {
        return;
      }
      this.shwoJw = false;
      this.formData.jw = item.keys;
      this.$forceUpdate();
    },
    //选择销售
    choseXiaoshou(item, index) {
      if (this.isEdit == 3) {
        return;
      }
      this.shwoXs = false;
      this.formData.xs = item.keys;
      this.$forceUpdate();
    },
    chosefuwu(item, index) {
      if (this.isEdit == 3) {
        return;
      }
      this.shwoFw = false;
      this.formData.fw = item.keys;
      this.$forceUpdate();
    },
    chosezy(item, index) {
      if (this.isEdit == 3) {
        return;
      }
      this.shwoZY = false;
      this.formData.zy = item.keys;
      this.$forceUpdate();
    },
    chosezjs(item, index) {
      if (this.isEdit == 3) {
        return;
      }
      this.shwoZjs = false;
      this.formData.zjs = item.keys;
      this.$forceUpdate();
    },

    //拜访方式
    chosecustType(item, index) {
      if (this.isEdit == 3) {
        return;
      }
      this.formData.visitPath = item.keys;
      this.$forceUpdate();
    },
    chosecustAim(item, index) {
      if (this.isEdit == 3) {
        return;
      }
      this.formData.visitAimflag = item.keys;
      let arr = [...this.choseCustAimList];
      if (arr.length === 0) {
        arr.push(item.keys);
      } else {
        let index = arr.indexOf(item.keys);
        if (index > -1) {
          arr.splice(index, 1);
        } else {
          arr.push(item.keys);
        }
      }
      this.choseCustAimList = arr;
      this.$forceUpdate();
    },
    //通过Id查详情
    getInfoById(id) {
      let _this = this;
      _this.formData = {};
      let param = {
        id:id
      }
      sysHttp.getCustIinById(param).then(
        res => {
          if (res) {
              _this.formData = res;
              _this.getPhotoIds(_this.formData);
              if (_this.formData.visitTime) {
                let val = moment(_this.formData.visitTime).format('hh:mm');
                let h = val.split(":")[0];
                let mm = val.split(":")[1];
                let str = "上午 ";
                if (h > 12) {
                  str = "下午";
                }
                _this.formData.visitTimeVal = `${str} ${h}:${mm}`;
                _this.$forceUpdate();
              }
              if (_this.formData.clientType) {
                _this.clientType.map(item => {
                  if (item.value == _this.formData.clientType) {
                    _this.formData.clientTypeValue = item.key;
                  }
                });
              }

              if (_this.formData.visitAim) {
                for (let i in _this.formData.visitAim) {
                  if (_this.formData.visitAim[i]) {
                    _this.choseCustAimList.push(i);
                    let keys = i;
                    let value = _this.formData.visitAim[i];
                    _this.callbackShwo(i, value);
                  }
                }
              }
            }
        }
      )
    },
    getPhotoIds(item) {
      let _this = this
      if (item && item.photoIds) {
        let arr = item.photoIds.split(",");
        for (let i = 0; i < arr.length; i++) {
           _this.picList.push({
              keys: i,
              value: arr[i]
            });

          // let param = {
          //   imageIds: arr[i] 
          // }
          // sysHttp.queryPincInfoById(param).then(
          //   res => {
          //     _this.picList.push({
          //       keys: arr[i],
          //       value: res.result
          //     });
          //   }
          // )
        }
        // alert(JSON.stringify(_this.picList))
      }
    },

    callbackShwo(i, value) {
      if (i === "01") {
        let val = this.yuefangList.filter(item => item.value === value);
        if (val !== undefined && val.length > 0) {
          this.formData.yf = val[0].keys;
        } else {
          this.shwoYFVal = value;
          this.formData.yf = "03";
        }
      }

      if (i === "02") {
        let val = this.jiaWenList.filter(item => item.value === value);
        if (val !== undefined && val.length > 0) {
          this.formData.jw = val[0].keys;
        } else {
          this.shwoJwVal = value;
          this.formData.jw = "06";
        }
      }

      //销售
      if (i === "03") {
        let val = this.xiaoshouList.filter(item => item.value === value);
        if (val !== undefined && val.length > 0) {
          this.formData.xs = val[0].keys;
        } else {
          this.shwoXsVal = value;
          this.formData.xs = "07";
        }
      }
      //fw
      if (i === "04") {
        let val = this.fuwuList.filter(item => item.value === value);
        if (val !== undefined && val.length > 0) {
          this.formData.fw = val[0].keys;
        } else {
          this.shwoFwVal = value;
          this.formData.fw = "06";
        }
      }
      //zhuanjieshao
      if (i === "05") {
        let val = this.jieshaoList.filter(item => item.value === value);
        if (val !== undefined && val.length > 0) {
          this.formData.zjs = val[0].keys;
        } else {
          this.shwoZjsVal = value;
          this.formData.zjs = "04";
        }
      }
      //zhuanjieshao
      if (i === "06") {
        let val = this.addUser.filter(item => item.value === value);
        if (val !== undefined && val.length > 0) {
          this.formData.zy = val[0].keys;
        } else {
          this.shwoZYVal = value;
          this.formData.zy = "06";
        }
      }
      this.$forceUpdate();
    },

    //s删除

    deleteDayAndMonth() {
      let param = {
        id: this.formData.id,
        empId: this.formData.empId
      };
      let _that = this;
      this.$refs.myConfirm.showModal();
      this.confirmOptions = {
        confirmContent: "确认删除当前拜访记录？",
        btnFlag: true,
        success: function() {
          sysHttp.deleteUpdataCust(param).then(
            res => {
              if (res) {
                modal.toast({
                  message: "删除成功",
                  duration: 0.3
                });
                if (_that.judgeStatus == "") {
                  sessionStorage.setItem("keyId", 2);
                } else {
                  sessionStorage.setItem("keyId", 5);
                }
                _that.$router.replace({ path: "/work" });
              }
            }
          )
        },
        error: function() {
        }
      }
    },
    //修改
    upDateDayAndMonth() {
      sessionStorage.setItem("keyId", 2);
      let param = Object.assign({},this.formData);
      let arr = [];
      this.picList.map(item => {
        arr.push(item.keys);
      });
      param.photoIds = arr.toString();
      if (this.title === "新增拜访记录") {
        param.timeTargetType = "01";
      } else {
        param.timeTargetType = "02";
      }
      this.loading = true
      let _this = this
      sysHttp.UpdataCust(param).then(
        res => {
          if (res) {
            _this.loading = false
            modal.toast({
              message: "编辑成功",
              duration: 0.3
            });
            if (_this.judgeStatus == "") {
              sessionStorage.setItem("keyId", 2);
            } else {
              sessionStorage.setItem("keyId", 5);
            }
            _this.$router.replace({ path: "/work" });
          }
        }
      )
    },
    //  新增
    addUpDayAndMonth() {
      // this.formData.visitTime = '2020-04-27 14:16'//masy
      // this.formData.visitTimeVal = '2020-04-27 14:16'
      // this.formData.visitName = '新增拜访客户'//masy
      // this.formData.clientType = '01'//masy
      // this.formData.clientTypeValue = '01'//masy
      // this.formData.visitAddress = '上海市浦东新区'//masy
      if (!this.formData.visitTimeVal) {
        modal.toast({
          message: "您未录入拜访时间",
          duration: 0.8
        });
        return;
      }

      if (!this.formData.visitName) {
        modal.toast({
          message: "您未录入客户",
          duration: 0.8
        });
        return;
      }

      if (!this.formData.clientTypeValue) {
        modal.toast({
          message: "您未录入客户类型",
          duration: 0.8
        });
        return;
      }
      if (!this.formData.visitPath) {
        modal.toast({
          message: "您未录入拜访方式",
          duration: 0.8
        });
        return;
      }

      let visitAimTemp = {};
      if (this.choseCustAimList.length === 0) {
        modal.toast({
          message: "您未录入拜访目的",
          duration: 0.8
        });
        return;
      } else {
        if (this.choseCustAimList.includes("01") && !this.formData.yf) {
          modal.toast({
            message: "您未录入拜访结果约访",
            duration: 0.8
          });
          return;
        } else if(this.choseCustAimList.includes("01") && this.formData.yf) {
          this.yuefangList[2].value = this.shwoYFVal;
          let val = this.yuefangList.filter(
            item => item.keys === this.formData.yf
          );
          visitAimTemp["01"] = val.length === 0 ? "" : val[0].value;
        }
        if (this.choseCustAimList.includes("02") && !this.formData.jw) {
          modal.toast({
            message: "您未录入拜访结果加温",
            duration: 0.8
          });
          return;
        } else if(this.choseCustAimList.includes("02") && this.formData.jw) {
          this.jiaWenList[5].value = this.shwoJwVal;
          let val = this.jiaWenList.filter(
            item => item.keys === this.formData.jw
          );
          visitAimTemp["02"] = val.length === 0 ? "" : val[0].value;
        }

        if (this.choseCustAimList.includes("03") && !this.formData.xs) {
          modal.toast({
            message: "您未录入拜访结果销售",
            duration: 0.8
          });
          return;
        } else if(this.choseCustAimList.includes("03") && this.formData.xs){
          this.xiaoshouList[6].value = this.shwoXsVal;
          let val = this.xiaoshouList.filter(
            item => item.keys === this.formData.xs
          );
          visitAimTemp["03"] = val.length === 0 ? "" : val[0].value;
        }
        if (this.choseCustAimList.includes("04") && !this.formData.fw) {
          modal.toast({
            message: "您未录入拜访结果服务",
            duration: 0.8
          });
          return;
        } else if(this.choseCustAimList.includes("04") && this.formData.fw) {
          this.fuwuList[5].value = this.shwoFwVal;
          let val = this.fuwuList.filter(
            item => item.keys === this.formData.fw
          );
          visitAimTemp["04"] = val.length === 0 ? "" : val[0].value;
        }
        if (this.choseCustAimList.includes("06") && !this.formData.zy) {
          modal.toast({
            message: "您未录入拜访结果增员",
            duration: 0.8
          });
          return;
        } else if(this.choseCustAimList.includes("06") && this.formData.zy) {
          this.addUser[5].value = this.shwoZYVal;
          let val = this.addUser.filter(item => item.keys === this.formData.zy);
          visitAimTemp["06"] = val.length === 0 ? "" : val[0].value;
        }
        if (this.choseCustAimList.includes("05") && !this.formData.zjs) {
          modal.toast({
            message: "您未录入拜访结果转介绍",
            duration: 0.8
          });
          return;
        } else if(this.choseCustAimList.includes("05") && this.formData.zjs) {
          this.jieshaoList[3].value = this.shwoZjsVal;
          let val = this.jieshaoList.filter(
            item => item.keys === this.formData.zjs
          );
          visitAimTemp["05"] = val.length === 0 ? "" : val[0].value;
        }
      }
      if (!this.formData.visitAddress) {
        modal.toast({
          message: "您未录入拜访地点",
          duration: 0.8
        });
        return;
      }
      this.formData.visitAim =  visitAimTemp
      sessionStorage.setItem("keyId", 2);
      if (this.$route.query.isEdit === 2) {
        this.upDateDayAndMonth();
      }  else {
        this.formData.empId = this.userInfo.empId
        
        let param = Object.assign({}, this.formData);
        if (this.title === "日目标新增") {
          param.timeTargetType = "01";
        } else {
          param.timeTargetType = "02";
        }

        param.visitAim = visitAimTemp;
        let arr = [];
        // alert(JSON.stringify(this.picList))
        this.picList.map(item => {
          arr.push(item.value);
        });
        param.photoIds = arr.toString();
        
        this.loading = true
        let _this = this
        // alert(JSON.stringify(param))
        let res = sysHttp.addUpdataCust(param)
        res.then(
          response => {
            if(response == 1){
               _this.loading = false
              modal.toast({
                message: "添加成功",
                duration: 0.3
              });
              if (_this.judgeStatus == "") {
                sessionStorage.setItem("keyId", 2);
              } else {
                sessionStorage.setItem("keyId", 5);
              }
              _this.$router.replace({ path: "/work" });
              console.log("请求结果：" + res.data);
            }
          }
        ).catch(
           
        )
        
        // $api.ajax(
        //   {
        //     url: "addUpdataCust",
        //     method: "POST", //默认 GET，默认可以省略
        //     data: param //可以不填写，默认为 ""
        //   },
        //   res => {
        //     if (res.status === 200) {
        //       this.loading = false
        //       modal.toast({
        //         message: "添加成功",
        //         duration: 0.3
        //       });
        //       if (this.judgeStatus == "") {
        //         sessionStorage.setItem("keyId", 2);
        //       } else {
        //         sessionStorage.setItem("keyId", 5);
        //       }
        //       this.$router.replace({ path: "/work" });
        //       console.log("请求结果：" + res.data);
        //     }
        //   }
        //  );
      }
    },
    approvalThrough() {
      if (this.approvalOption == "") {
        modal.toast({
          message: "请输入审批意见",
          duration: 1
        });
        return;
      }
      if (this.approvalOption.length > 100) {
        modal.toast({
          message: "审批意见字数不能大于100个字",
          duration: 1
        });
        return;
      }
      // 审批通过
      let param = {
        id: this.$route.query.quetyId,
        judgeReply: this.approvalOption,
        judgeStatus: this.judgeStatus
      };
      let _this = this;
      sysHttp.activityDetailsPass(param).then(
        res => {
          if (res) {
            modal.toast({
              message: "审批成功",
              duration: 0.5
            });
            if (_this.judgeStatus == "") {
              sessionStorage.setItem("keyId", 2);
            } else {
              sessionStorage.setItem("keyId", 5);
            }
            _this.$router.replace({ path: "/work" });
          } else {
            modal.toast({
              message: res.msg,
              duration: 0.5
            });
          }
        }
      )
    },
    modify() {
      if (this.approvalOption == "") {
        modal.toast({
          message: "请输入审批意见",
          duration: 1
        });
        return;
      }
      if (this.approvalOption.length > 100) {
        modal.toast({
          message: "审批意见字数不能大于100个字",
          duration: 1
        });
        return;
      }
      // 退回修改
      let param = {
        id: this.$route.query.quetyId,
        judgeReply: this.approvalOption,
        judgeStatus: this.judgeStatus
      };
      let _this = this;
      sysHttp.activityDetailsUnPass(param).then(
        res => {
          if (res.success) {
            modal.toast({
              message: "退回成功",
              duration: 0.5
            });
            if (_this.judgeStatus == "") {
              sessionStorage.setItem("keyId", 2);
            } else {
              sessionStorage.setItem("keyId", 5);
            }
            _this.$router.replace({ path: "/work" });
          } else {
            modal.toast({
              message: res.msg,
              duration: 0.5
            });
          }
        }
      )
    }
  }
};
</script>

<style lang="css" scoped>
@import "../../../utils/assets/globe.css";
.loading{
  position: fixed;
  left: 0;
  bottom: 0;
  top: 0;
  right: 0;
  display:-ms-flex;
  display:-webkit-flex;
  display:flex;
  align-items:center;
}
.indicator-text{
  color:#88888888;
  font-size:42px;
  text-align:center;
}
.indicator{
  margin-top:16px;
  height:40px;
  width:40px;
  color:blue;
}
.backMessage {
  width: 100%;
  padding: 30px 0;
  background: #fff;
}
.replay-import {
  font-size: 32px;
  font-weight: 500;
}
.replay-red {
  color: #e8a622;
  font-size: 32px;
  font-weight: 500;
  width: 100%;
  min-height: 40px;
  margin-top: 20px;
}
.state-waps {
  margin: 8px 0;
  padding-bottom: 10px;
  border-bottom: 1px solid #dedede;
}
.wap-row-line {
  border-bottom: 1px solid #dde;
}
.impoets {
}
.impoets::before {
  content: "*";
  color: red;
}
.no-import {
  /* margin-left: 14px; */
  -color: #000000;
}
.inputs {
  flex: 1;
  height: 70px;
  line-height: 70px;
}
.month-aim-add {
  padding: 8px 0;
}
.wap-row {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.237333rem;
  margin: 0 40px;
}
.textareInput {
  /* border: 1px solid #ddd; */
  margin-top: 16px;
  font-size: 0.426rem;
  width: 100%;
}
.yuan {
  margin-left: 11px;
}
.itemMargin {
  margin: 0.21333rem 0.21333rem !important; 
}
.nowrap {
  flex-wrap: nowrap;
}
.wrap {
  flex-wrap: wrap;
}
.state-tag {
  flex-direction: row;
  /* margin: 8px 0; */
  flex-wrap: wrap;
}
.state-item{
  min-width: 22.5%;
  margin-right: 3%;
}
.state-item:nth-child(4n){
  margin-right: 0;
}
.state-wap-item {
  /* min-width: 145px;
  width: auto; */
  font-size: 0.426rem;
  background: #f5f5f5;
  align-items: center;
  /* margin-right: 32px; */
  height: 0.77333rem;
  justify-content: center;
  padding: 8px;
  border-radius: 7px;
  color: #333;
  line-height: 0.77333rem;
  margin-bottom: 20px;
}
.is-notic-item-active {
  background-color: #f5fafd;
  color: #0670ba;
}
.is-notic-item-active-add{
  margin-left: -25.5%;
}
.wap-row-plain {
  margin-top: 0;
  flex-direction: column;
  flex:4;
}
.tag-left {
  /* margin-left: 0.38rem; */
}
.nob-wap {
  flex-direction: row;
  width: 70%;
  justify-content: flex-end;
}
.empty {
  width: 85%;
  text-align: right;
  padding-right: 0.345rem;
}
.empty-left {
  flex-direction: row;
  align-items: center;
}
.empty-left p {
  color: #666;
  font-size: 24px;
  font-weight: 500;
}
.empty-left-user {
  flex-direction: row;
}
.empty-user {
  padding-right: 0.5rem;
}
.pic {
  width: 40px;
  height: 40px;
  margin-right: 0.3rem;
}
.count-num {
  color: #c2c0c0;
  justify-content: flex-end;
}
.cust-aim {
  justify-content: space-between;
}
.more {
  font-size: 0.382rem;
  margin-right: 0.35rem;
  color: #ddd;
}
.result-wap {
  background: #f6f6f6;
  width: 104.5%;
  margin-left: -0.21rem;
}
.result {
  margin: 0.12rem;
  background: #fff;
  border-radius: 0.182rem;
  width:100%;
}
.cust-res {
  /* margin: 0.2rem; */
}
.addActive[data-v-96dd55d8] {
  background: #fff;
  border: 1px dashed #ddd;
}
.addActive:after {
  content: "+";
  /* height: 0.467rem; */
  width: 0.467rem;
  text-align: center;
}
.bor {
  width: 100%;
}
.bor-input {
  border-bottom: 0.031rem solid #ddd;
  height: 0.98rem;
  line-height: 0.98rem;
  margin-bottom: 0.2rem;
  border-radius: 0;
}
.count-length {
  position: absolute;
  bottom: 0.42rem;
  right: 0.342rem;
  color: #ddd;
  font-size: 24px;
  font-weight: 500;
}
.approvalOptions {
  margin-bottom: 118px;
}
.optionBtn {
  display: flex;
  justify-content: flex-start;
  flex-direction: initial;
  width: 100%;
  height: 108px;
  background: rgba(255, 255, 255, 1);
  box-shadow: 0px 0px 16px 0px rgba(0, 0, 0, 0.1);
  position: fixed;
  bottom: 0;
  left: 0;
}
.optionBtn > div {
  flex: 1;
  height: 50px;
  line-height: 50px;
  text-align: center;
  margin-top: 29px;
  font-size: 26px;
}
.optionBtn > div:nth-child(1) {
  border-right: 1px solid #dedede;
  color: #000000;
}
.optionBtn > div:nth-child(2) {
  color: #0770ba;
}
.optionBtn > div > figure {
  width: 28px;
  height: 28px;
  margin-left: 80px;
  margin-top: 10px;
  position: absolute;
}
.optionTitle {
  margin-top: 34px;
  margin-left: 14px;
  height: 30px;
  font-size: 32px;
  font-weight: 400;
  color: rgba(0, 0, 0, 1);
  line-height: 30px;
}
.lineBottom {
  width: 40px;
  height: 5px;
  background: rgba(7, 112, 186, 1);
  border-radius: 3px;
  margin-left: 50px;
}
.approvalOptions > textarea {
  font-size: 24px;
  padding: 20px;
}
.btns-w {
  flex: 1;
  align-items: center;
  margin-top: 26px;
  height: 1rem;
}
.save-eee {
  background-color: #eee !important;
}
.active-btn {
  background-color: #0670ba  !important;
}
.save-btn {
  flex: 1;
  width: 3.90667rem !important;
}
.big-btns {
  margin-top: 0.413733rem;
  margin-bottom: 1rem;
}
.btns {
  flex-direction: row;
  justify-content: center;
  margin-bottom: 0.5rem;
}
.pics {
  height: 1.45rem;
  /* width: 1.45rem; */
  /* border: 1px solid #ddd; */
  -border-radius: 0.2345rem;

  margin: 0 0.1rem;
}

.imagesS {
  height: 1.45rem;
  width: 1.45rem;
  border: 1px solid #ddd;
  border-radius: 0.2345rem;
}
.adds {
  height: 1.5rem;
  width: 1.5rem;
  -border: 1px dashed #ddd;
  justify-content: center;
  align-items: center;
  font-size: 0.61rem;
  border-radius: 0.2345rem;
  display:flex;
  flex-direction: column;
  background:#F4F1F4;
}
.add{
  display:block;
  text-align:center;
  font-size:1rem;
  /* border:1px dashed #00000087; */
  height:0.61rem;
  line-height:0.61rem;
  color:#5D788A;
  margin-bottom:5px;
}
.chosePic-wap-item {
  height: 1.2rem;
  flex-direction: row;
  justify-content: center;
  align-items: center;
}
.close-chosePic {
  color: #409edf;
}
.close-t {
  position: absolute;
  right: 0.091rem;
  width: 0.42rem;
  height: 0.42rem;
  border-radius: 50%;
  background: #191919;
  justify-content: center;
  align-items: center;
  color: #fff;
}
.conditionLength {
  position: absolute;
  right: 5px;
  bottom: 5px;
  color: #999999;
}
.pisc {
  justify-content: left;
}
.mar-bottom {
  margin-bottom: 20px;
}
/* input::-webkit-input-placeholder {
  color: #ccc;
  font-size: 24px;
  font-weight: 300;
  line-height: 1rem;
}
textarea::-webkit-input-placeholder {
  color: #ccc;
  font-size: 24px;
  font-weight: 300;
  line-height: 1rem;
} */
.placeHoder {
  color: #ccc;
  font-size: 24px;
  font-weight: 300;
  line-height: 1rem;
}
.wap-item{
  /* margin:0 0.11333rem; */
}
.narrow{
  font-size: 0.426rem;
  color:#000000;
}
.weex-text{
  font-weight: normal;
  color: #666;
  font-size: 0.426rem;
}
.class-div-interval{
  height: 0.23333rem;
  background: #f9f9f9;
  margin-bottom: 0.13333rem;
}
</style>
